﻿/*
======================================================================================
CreatedTime:2011-10-28
Description:三层架构业务逻辑层父类
======================================================================================
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Collections;
using System.Data.SqlClient;
using DAL;
using Models;
namespace BLL
{
	/// <summary>
	/// 业务逻辑类Tb_Message 的摘要说明。
	/// </summary>
	public class Tb_MessageManagerBase
    {
	    protected readonly DAL.Tb_MessageServiceBase dal = new DAL.Tb_MessageServiceBase();
		
		#region 构造方法
		/// <summary>
		/// 业务逻辑类Tb_Message 的构造方法。
		/// </summary>
        /// <returns></returns>
		public Tb_MessageManagerBase()
        { }
		#endregion
		
		#region  成员方法
		#region 是否存在该记录
        /// <summary>
        /// Tb_Message表是否存在该记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns>bool</returns>
        public bool ExistsTb_Message(int id)
        {
            return dal.ExistsTb_Message(id);
        }
		#endregion
		#region 增加一条数据
		/// <summary>
		/// Tb_Message表增加一条数据
		/// </summary>
		/// <param name="tb_Message">对象</param>
        /// <returns>row</returns>	
		public int AddTb_Message(Tb_Message tb_Message)
		{
			return dal.AddTb_Message(tb_Message);
		}
		#endregion
		#region 更新一条数据
		/// <summary>
		/// Tb_Message表更新一条数据
		/// </summary>
		/// <param name="tb_Message">对象</param>
        /// <returns>row</returns>
		public int ModifyTb_Message(Tb_Message tb_Message)
		{
			return dal.ModifyTb_Message(tb_Message);
		}
		#endregion
	    #region 删除一条数据
		/// <summary>
		/// 根据Tb_Message表主键ID删除一条数据
		/// </summary>
		/// <param name="id"></param>
        /// <returns>row</returns>
		public int DeleteTb_MessageById(int id)
		{
			return dal.DeleteTb_MessageById(id);
		}
		#endregion
		#region 得到一个对象实体
		/// <summary>
		/// Tb_Message表通过id得到一个对象实体
		/// </summary>
		/// <param name="id"></param>
        /// <returns>Tb_Message</returns>
		public Tb_Message GetTb_MessageById(int id)
		{
			return dal.GetTb_MessageById(id);
		}
		#endregion
		#region 得到一个对象实体,返回List泛型集合
		/// <summary>
		/// Tb_Message表得到一个泛型实体对象
		/// </summary>
        /// <returns>IList</returns>
		public IList<Tb_Message> GetAllListFromTb_Messages()
		{
			return dal.GetAllTb_Messages();
		}
		#endregion
		#region 得到一个对象实体,返回List泛型集合
		/// <summary>
		/// Tb_Message通过id得到实体对象,返回List泛型集合
		/// </summary>
        /// <returns>IList</returns>
		public IList<Tb_Message> GetListFromTb_MessageById(int id)
		{
		string sql =@"Select * From Tb_Message 
                    Where id=@id";
			try
			{
				SqlParameter[] para = new SqlParameter[]
				{
                 new SqlParameter("@id",id)
				};
				return dal.GetTb_MessagesBySql(sql,para);
			}
			catch (Exception e)
			{
				throw e;
			}
		}					
		#endregion
		#region
		/// <summary>
		/// Tb_Message表通过sql语句的条件（“where”已经写上）得到一个实体对象（泛型集合）
		/// </summary>
		/// <param name="strWhere">strWhere</param>
        /// <returns>IList</returns>
		public IList<Tb_Message> GetTb_MessagesByStrWhere(string strWhere)
		{
		    return dal.GetTb_MessagesByStrWhere(strWhere);
		}
		#endregion
		#region 获得数据列表
		/// <summary>
        /// Tb_Message表根据条件字符串strWhere获得数据列表
        /// </summary>
		/// <param name="StrWhere">条件字符串</param>
        /// <returns>DataSet</returns>
        public DataSet GetDataSetFromTb_Message(string strWhere)
        {
            return dal.GetDataSetFromTb_Message(strWhere);
        }
		#endregion
		#region 获得全部数据列表
		/// <summary>
        /// Tb_Message获得数据列表
        /// </summary>
        /// <returns>DataSet</returns>
        public DataSet GetDataSetFromTb_Message()
        {
            return dal.GetDataSetFromTb_Message("");
        }
		#endregion
		#region 接收条件和参数Hashtable，返回DataTable
		/// <summary>
		/// Tb_Message表接收条件和参数Hashtable，返回DataTable
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>DataTable</returns>
		public DataTable GetDataTableFromTb_Message(string strWhere,Hashtable table)
		{
			return dal.GetDataTableFromTb_Message(strWhere,table);
		}
		#endregion
		#region 接收条件和参数Hashtable，返回List泛型集合
		/// <summary>
		/// Tb_Message表接收条件和参数Hashtable，返回List泛型集合
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>IList</returns>
		public IList<Tb_Message> GetListFromTb_Message(string strWhere,Hashtable table)
		{
			return dal.GetListFromTb_Message(strWhere,table);
		}
		#endregion
		#region 接收条件和参数Hashtable，返回一个实体类对象
		/// <summary>
		/// Tb_Message表接收条件和参数Hashtable，返回一个实体类对象
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>Tb_Message对象</returns>
		public Tb_Message GetModelTb_MessageByWhere(string strWhere, Hashtable table)
		{
			return dal.GetModelFromTb_MessageByWhere(strWhere, table);
		}
		#endregion
			#region 接收条件，返回一个实体类对象
		/// <summary>
		/// Tb_Message表接收条件，返回一个实体类对象
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>Tb_Message对象</returns>
		public Tb_Message GetModelTb_MessageByWhere(string strWhere)
		{
			return dal.GetModelFromTb_MessageByWhere(strWhere);
		}
		#endregion
		#region 接收条件和参数Hashtable，删除符合条件的记录
		/// <summary>
		/// Tb_Message表接收条件和参数Hashtable，删除符合条件的记录
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>row</returns>
		public int DeleteTb_MessageByWhere(string strWhere, Hashtable table)
		{
			return dal.DeleteTb_MessageByWhere(strWhere, table);
		}
			/// <summary>
		/// Tb_Message表接收条件和参数，删除符合条件的记录
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>row</returns>
		public int DeleteTb_MessageByWhere(string strWhere)
		{
			return dal.DeleteTb_MessageByWhere(strWhere);
		}
		#endregion
		#endregion
	}
}
